#include <map>
#include <vector>
#include <set>
#include <queue>
using namespace std;
#include <boost/shared_ptr.hpp>
#include <wx/wx.h>
#include <wx/dir.h>
#include <wx/string.h>
#include <wx/listctrl.h>
#include <wx/gdicmn.h>
#include <wx/volume.h>
#include <wx/file.h>
#include <wx/filename.h>
#include "wx/dnd.h"
#include "wx/dataobj.h"
#include "wx/panel.h"

#include "RWLock.h"
#include "DirectoryWatcher.h"
#include "DirectoryCache.h"
#include "FilePropertiesWatcher.h"
#include "MainListView.h"
#include "ItemInfo.h"
#include "Utils.h"
#include "SyncQueue.h"
#include "BackgroundIconLoader.h"
#include "Application.h"
#include "FileOperation.h"
#include "MainFrame.h"
#include "MainFrameImpl.h"
#include "CompositeFilePanel.h"

CompositeFilePanel::CompositeFilePanel(wxWindow *parent, unsigned int pId) : wxPanel(parent, wxID_ANY), id(pId)
{
    pathText = new wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER);
    //pathText->AutoCompleteFileNames();

    pathText->Connect(wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler(CompositeFilePanel::OnPathTextEnter), NULL, this);

    mainListView = new MainListView(this, id);

    wxBoxSizer *bSizer = new wxBoxSizer(wxVERTICAL);
    bSizer->Add(pathText, 0, wxEXPAND, 0);
    bSizer->Add(mainListView, 1, wxEXPAND, 0);

    SetSizer(bSizer);
    Layout();
    bSizer->Fit(this);
}
MainListView *CompositeFilePanel::GetMainListView()
{
    return mainListView;
}
void CompositeFilePanel::OnPathTextEnter(wxCommandEvent &event)
{
    mainListView->ChangePath(event.GetString());
    mainListView->SetFocus();
}
wxTextCtrl *CompositeFilePanel::GetPathText()
{
    return pathText;
}